package _15_generics._15_2;

/**
 * 可以让该类直接持有Object对象，这样这个类就可以持有任意对象
 */
public class Holder2 {
    private Object o;
    public Holder2(Object o){
        this.o = o;
    }
    public void set(Object o){
        this.o=  o;
    }
    public Object get(){
        return o;
    }

    public static void main(String[] args) {
        Holder2 h2 = new Holder2(new Automobile());
        Automobile o = (Automobile) h2.get();
        h2.set("hello world");
        String s = (String) h2.get();
        h2.set(1);
        Integer i = (Integer) h2.get();
    }
}
